import request from '@/utils/request';

export const selectAllBlogs  = (params: any) => {
  return request({
    url: `api/selectAllBlogs`,
    method: 'get',
  });
};

export const selectAllFmerBlogs  = (params: any) => {
  return request({
    url: `api/selectAllFmerBlog`,
    method: 'get',
  });
};

export const likePost = (params: any) => {
  console.log(params)
  return request({
    url: `/api/likeBlog`,
    method: 'post',
    headers: {
      'Content-Type': 'application/json',  // 确保是 json 格式
    },
    data: {
      bid: params
    }
  });
};


export const selectAllComments = (params: any) => {
  return request({
    url: 'api/selectAllComments',
    method: 'post',
    data:{
      bid: params
    }
  });
};

export const pushComment = (params:any)=>{
  return request({
    url:'api/pushComment',
    method:'post',
    data:{
      bid:params.bid,
      comment:params.comment
    }
  })

}

export const pushBlog = (params:any)=>{
  return request({
    url:'api/pushBlog',
    method:'post',
    headers: {
      'Content-Type': 'multipart/form-data'  // 确保请求头为 multipart/form-data
  },
  data: params, // 使用 FormData
  })

}





